#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>

class Date {
public:
	void SetDate(int year, int month, int day) {
		_year = year;
		_month = month;
		_day = day;
	}
	void Print() {
		printf("%d-%d-%d\n", _year, _month, _day);
	}

private:
	int _year;
	int _month;
	int _day;
};

int main(void)
{
	Date d1;
	d1.SetDate(2022, 3, 8);
	d1.Print();

	Date d2;
	d2.SetDate(2022, 3, 12);
	d2.Print();

	return 0;
}
————————————————

zdfs

原文链接：https ://blog.csdn.net/weixin_50502862/article/details/123359614